package cn.sunshine.basic.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AjaxResult {
    private Boolean success = true;
    private String message = "操作成功";
    //用来封装额外的返回函数。
    public Object resultObj;

    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this; // 谁调用我我就返回谁。
    }

    public AjaxResult setMessage(String message) {
        this.message = message;
        return this; // 谁调用我我就返回谁。
    }

    public static AjaxResult getAjaxResult() {

        return new AjaxResult();
    }

    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }
}
